<?php
namespace app\controller;

//use think\Request;
use think\facade\Request;
class Rely
{
    protected $request;
    public function __construct(Request $request){
        $this->request = $request;
    }
//    public function index(Request $request){
//        return $request->param('username');
//    }

    public function get($id=0){
        //return $this->request->param('username');
        //return \think\facade\Request::param('username');
        //return request()->param('username');
        //return Request::url(true);
        //return Request::root(true);
        //获取控制器和获取方法的信息。
        //return Request::controller().' | '.Request::action();
        //判断url参数是否存在
        //dump(Request::has('name','get'));

        //dump(Request::param('name'));
        //dump(Request::param());
        //数据不过滤,即获取原始数据。
        //dump(Request::param(false));
        //dump(Request::param(['name','age']));

        //dump(Request::get('id'));
        //dump(Request::route('id'));
        //是否存在name字段。
        //dump(input('?get.name'));
        //得到name的值。
        //dump(input('get.name'));
//        dump(Request::isGet());
//        dump(Request::isPost());

        //echo $id;
        //echo Request::ext();

        //return redirect('/tp/public/index.php/Address/index');
        //使用url自动生成跳转地址，普通地址或路由地址。
        //return redirect(url('address/index'));
        //return redirect(url('address/index'))->with('name','Lee');
        if(session('?flag')){
            return '死机警告！';
        }
        return redirect(url('address/index'))->remember();
    }
}